Skip to content

Conversation

swallez
Copy link
Member

@swallez swallez commented Aug 12, 2025

Open API 3.0 doesn't allow attaching docs and additional properties to a $ref type definition. Because of this (and this was a forgotten TODO) many property descriptions were dropped in the OpenAPI output.

This PR fixes this by using a common/recommended workaround consisting in using a single allOf inline schema around the reference.

Fixes #5082.

@szabosteve can you verify that the doc generation pipeline correctly picks up this change?

Example (taken from the diff):

"chunking_settings": {
    "$ref": "#/components/schemas/inference._types.InferenceChunkingSettings"
}

Becomes:

"chunking_settings": {
    "externalDocs": {
      "url": "https://www.elastic.co/docs/explore-analyze/elastic-inference/inference-api#infer-chunking-config"
    },
    "description": "The chunking configuration object.",
    "allOf": [
     {
        "$ref": "#/components/schemas/inference._types.InferenceChunkingSettings"
      }
    ]
}

Copy link
Contributor

Following you can find the validation changes against the target branch for the APIs.

No changes detected.

You can validate these APIs yourself by using the make validate target.

@szabosteve
Copy link
Contributor

Thank you so much for this fix, @swallez! I asked the folks responsible for the docs generation process to verify if they can pick this change up correctly. I'll get back to you as soon as I have an answer.

@szabosteve
Copy link
Contributor

@swallez The folks at Bump pushed a modification on their side to support the new input. Just checked and your fix works fine! Thank you very much for your work, it significantly improves the API docs quality!

Screenshot 2025-08-25 at 10 59 49

Parameter descriptions like sevice and input_type, for example, were empty before your fix!

Copy link
Contributor

@szabosteve szabosteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@swallez swallez force-pushed the fix-property-docs branch from 525fb7c to 38aaed4 Compare August 25, 2025 09:41
@swallez swallez merged commit ef9f1da into main Aug 25, 2025
8 checks passed
@swallez swallez deleted the fix-property-docs branch August 25, 2025 10:17
Copy link
Contributor

The backport to 8.19 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.19 8.19
# Navigate to the new working tree
cd .worktrees/backport-8.19
# Create a new branch
git switch --create backport-5129-to-8.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ef9f1da6e371f8681e1a603b6afc7637a0d704f0
# Push it to GitHub
git push --set-upstream origin backport-5129-to-8.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.19

Then, create a pull request where the base branch is 8.19 and the compare/head branch is backport-5129-to-8.19.

Copy link
Contributor

The backport to 9.1 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-9.1 9.1
# Navigate to the new working tree
cd .worktrees/backport-9.1
# Create a new branch
git switch --create backport-5129-to-9.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ef9f1da6e371f8681e1a603b6afc7637a0d704f0
# Push it to GitHub
git push --set-upstream origin backport-5129-to-9.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-9.1

Then, create a pull request where the base branch is 9.1 and the compare/head branch is backport-5129-to-9.1.

swallez added a commit that referenced this pull request Aug 25, 2025
For properties, generate an allOf schema with descriptions instead of references
swallez added a commit that referenced this pull request Aug 25, 2025
For properties, generate an allOf schema with descriptions instead of references
swallez added a commit that referenced this pull request Aug 25, 2025
…5196)

For properties, generate an allOf schema with descriptions instead of references
swallez added a commit that referenced this pull request Aug 25, 2025
…5195)

For properties, generate an allOf schema with descriptions instead of references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[OpenAPI] Parameter descriptions are missing from the generated OpenAPI file while present in the ts files
2 participants